﻿using System.Collections.Generic;
using Church.Common;

namespace Church.Models.Shared
{
	public class PuzzlesModel
	{
		#region Variables

		private string _footerHelp;

		#endregion

		#region Properties

		public IList<PuzzleModel> Puzzles { get; set; }

		public int CountPuzzles { get; set; }

		public string FooterHelp
		{
			get
			{
				if (_footerHelp == null)
					_footerHelp = string.Empty;
				return _footerHelp.Length > 50
					? string.Concat(_footerHelp.Substring(0, 47), "...")
					: _footerHelp;
			}
			set
			{
				_footerHelp = value ?? string.Empty;
			}
		}

		public bool IsShowBackLink { get; set; }

		#endregion

		#region Constructors

		public PuzzlesModel()
		{
			IsShowBackLink = true;
			Puzzles = new List<PuzzleModel>();
			for (var i = 0; i < Constants.DEFAULT_COUNT_PUZZLES; i++)
				Puzzles.Add(new PuzzleModel());
			CountPuzzles = Constants.DEFAULT_COUNT_PUZZLES;
			FooterHelp = string.Empty;
		}

		#endregion
	}
}